﻿using NHibernate;
using System.Collections.Generic;

namespace Golf.DataLayer
{
    using Core;

    public class CountyRepository : RepositoryBase, ICountyRepository
    {
        public IEnumerable<County> GetAll()
        {
            using (ISession session = SessionFactory.OpenSession())
            {
                ICriteria criteria = session.CreateCriteria(typeof(County));
                return criteria.List<County>();
            }
        }

        public County Get(int id)
        {
            using (ISession session = SessionFactory.OpenSession())
            {
                return session.Get<County>(id);
            }
        }
    }
}